    <div class="container">
      <div class="bg-putih">

        <div class="jdl-page">
          <?php echo isset($judul)?$judul:'<font color="#ccc">Judul Belum Diberikan</font>'; ?>
          <div class="clearfix"></div>
        </div>
        
        <?php echo display_flash(); ?>

        <div class="row">
          <div class="col-xs-4">
            <div class="btn-group btn-group-sm" role="group">
              <a href="<?php echo site_url('laporan_laba/excel'); ?>" class="btn btn-warning"><i class="fa fa-file-excel-o"></i>&nbsp;Unduh Excel</a>
            </div>
          </div>
          <div class="col-xs-6" style="float:right">
            <div class="input-group-3">
              <?php echo form_open('laporan_laba/cari'); ?>
                <button id="btn-search" type="submit" class="btn btn-primary btn-sm"><span class="glyphicon glyphicon-search"></span></button>
                <select id="selector" class="form-control input-sm" name="kelompok">
                  <option value=""> - - Pilih Kelompok - - </option>     
                  <?php
                    foreach ($kelompok as $value) {
                      if($KdKelompok == $value['KdKelompok']){
                        $s = "selected";
                      }else{
                        $s = "";
                      }
                      echo "<option value=".$value['KdKelompok']." $s>".$value['NmKelompok']."</option>";
                    }
                  ?>             
                </select>                             
                <span id="frm-input">
                  <input id="after" type="text" name="tgl_akhir" class="form-control input-sm" placeholder="Tanggal Akhir" style="width:25%" value="<?php echo $this->session->userdata('laba_tgl_akhir') ?>"/>
                  <input id="before" type="text" name="tgl_awal" class="form-control input-sm" placeholder="Tanggal Awal" style="width:25%" value="<?php echo $this->session->userdata('laba_tgl_awal') ?>"/>
                </span>
                <?php echo form_close(); ?> 
              </div>
            </div>
          </div>
        

        <table class="table table-striped table-hover margintop20">
          <thead>
            <tr>
              <th width="5%" style="text-align:center;">No</th>
              <th width="10%">Kode</th>
              <th >Nama Obat</th>
              <th >Kelompok Obat</th>
              <th >Stok Awal</th>
              <th >Pembelian</th>
              <th >Penjualan</th>
              <th >Stok Akhir</th>
              <th >Laba</th>
            </tr>
          </thead>
          <tbody>
            <?php 
              if(!empty($results)){
                foreach ($results as $row) {
            ?>
            <tr>
              <td align="center"><?php echo $ordinal_num++ ?></td>
              <td align="center"><?php echo $row['kdobat']?></td>
              <td><?php echo $row['nmobat']?></td>
              <td><?php echo $row['nmkelompok']?></td>
              <td align="right"><?php echo formatAngka($row['stok_awal'])?></td>
              <td align="right"><?php echo formatAngka($row['beli'])?></td>
              <td align="right"><?php echo formatAngka($row['jual'])?></td>
              <td align="right"><?php echo formatAngka($row['stok_akhir'])?></td>
              <td align="right">
                <?php 
                  $laba = ($row['stok_akhir'] + $row['jual']) - ($row['stok_awal'] + $row['beli']);
                  echo formatAngka($laba);
                ?>
              </td>
            </tr>
            <?php 
                }
              }else{
            ?>
            <tr>
              <td colspan="4" align="center">Tida ada data</td>
            </tr>
            <?php
              }
            ?>
          </tbody>
        </table>

        <center style="margin-top:-30px;">
          <ul class="pagination">
            <?php echo $pagination; ?>
          </ul>
        </center>

        <div class="clearfix"></div>
      </div>
    </div> <!-- /container -->

    <script type="text/javascript">
      $(document).ready(function(){
        $('#after, #before').datepicker({
          dateFormat: "dd/mm/yy",
          changeMonth: true,
          changeYear: true
        });
      });
    </script>